<Mcml
  xmlns="http://schemas.microsoft.com/2006/mcml"
  xmlns:cor="assembly://MSCorLib/System"
  xmlns:addin="assembly://Microsoft.MediaCenter/Microsoft.MediaCenter.Hosting"

  xmlns:me="Me">  
  <!--xmlns:ds="file://C:\Users\v-cpan\Desktop\PAGE\MCML\Diagnostics_DataSource.mcml"-->

  <!--xmlns:addin="assembly://Microsoft.MediaCenter/Microsoft.MediaCenter.Hosting"-->
  <!-- Color -->
  <Color Name="TitleColor" Color="255,255,255"/>
  <Color Name="SubTitleColor" Color="255,255,255"/>
  <Color Name="DescriptionColor" Color="149,214,253"/>
  <!-- Font -->
  <Font Name="TitleFont" Font="Microsoft YaHei,28"/>
  <Font Name="SubTitleFont" Font="Microsoft YaHei,22"/>
  <Font Name="DescriptionFont" Font="Microsoft YaHei,16"/>
  <!-- Image -->
  <Image Name="Background" Image="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/Microsoft.com/NV/Variable/MCE/Assets/Base64Binary/COMMON.BACKGROUND.PNG"/>
  <Image Name="Background1" Image="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/Microsoft.com/NV/Variable/MCE/Assets/Base64Binary/bg2.PNG"/>
  <Image Name="Background2" Image="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/Microsoft.com/NV/Variable/MCE/Assets/Base64Binary/bg2.PNG"/>
  <Image Name="ListFrame" Image="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/Microsoft.com/NV/Variable/MCE/Assets/Base64Binary/sqs.png" />
  <Image Name="NofocusedBackground" Image="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/Microsoft.com/NV/Variable/MCE/Assets/Base64Binary/COMMON.BUTTON.FIRSTRUN.DORMANT.FULL.PNG"/>
  <Image Name="FocusedBackground" Image="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/Microsoft.com/NV/Variable/MCE/Assets/Base64Binary/COMMON.BUTTON.LEFT.FOCUS.PNG"/>
  <Image Name="PressedBackground" Image="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/Microsoft.com/NV/Variable/MCE/Assets/Base64Binary/COMMON.BUTTON.LEFT.FOCUSOVERLAY.PNG"/>
  <Image Name="HoverBackground" Image="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/Microsoft.com/NV/Variable/MCE/Assets/Base64Binary/COMMON.BUTTON.LEFT.FOCUS.PNG"/>
  <Image Name="WinLogo" Image="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/Microsoft.com/NV/Variable/MCE/Assets/Base64Binary/MEDIACENTERLOGO.PNG"/>
  
  <UI Name="SearchSignal">
    <Properties>
      <cor:String Name="CityId" cor:String="$Required"/>
      <cor:String Name="CitynameCN" cor:String="$Required"/>

      <cor:String Name="Title" cor:String="Digital Antenna(DMB-TH PBDA)诊断"/>
      <cor:String Name="SubTitle" cor:String="信号强度调节"/>
      <cor:String Name="Description" cor:String="信号强度和信号质量是依次循环显示不同频道，如果只是显示某个频道的信号的实时情况请勾选某个频道，并调节天线的位置和角度以增强信号和强度。"/>
    </Properties>
    <Locals>
	<addin:AddInHost Name="AddInHost"/>
      <Command Name="Back" Description="上一步"/>
      <Command Name="Next" Description="下一步"/>
      <Command Name="Skip" Description="跳过"/>
      <Timer Name="Timer" Enabled="false" Interval="1500" />
      <BooleanChoice Name="IsCurrentCity" Value="false"/>
      <Choice Name="DataSet"/>
      <cor:String Name="TargetSource" cor:String="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/GPNVSCMD.do?cmd=SCAN;filename=Diagnostics_DataSource.mcml;city={0}"/>
      <ArrayListDataSet Name="ArrayList">
        <Source>
          <cor:String cor:String="1、请根据前述“地面数字电视设置注意事项”放置天线。"/>
          <cor:String cor:String="2、调节天线角度和方向找到最先有信号的频道。"/>
          <cor:String cor:String="3、在附近位置调节天线位置、方向和角度，在强度和质量不能再增加时记下此位置。"/>
          <cor:String cor:String="4、换另外的窗口或位置再重复前面步骤，选最好的位置固定天线。"/>
        </Source>
      </ArrayListDataSet>
    </Locals>
    <Rules>
      <Default Target="[Timer.Enabled]" Value="true" >
          <Actions>
          <Set Target="[TargetSource]" Value="[CityId]">
            <Transformer>
              <FormatTransformer Format="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/GPNVSCMD.do?cmd=SCAN;filename=Diagnostics_DataSource.mcml;city={0}"
                                 ExtendedFormat="####"/>
            </Transformer>
          </Set>
         </Actions>
      </Default>

      <Changed Source="[Next.Invoked]">
        <Actions>
          <Invoke Target="[AddInHost.ApplicationContext.CloseApplication]"/>
        </Actions>
      </Changed>
      <Changed Source="[Skip.Invoked]">
        <Actions>
          <Invoke Target="[AddInHost.ApplicationContext.CloseApplication]"/>
        </Actions>
      </Changed>
      <Changed Source="[Back.Invoked]">
        <Actions>
          <Navigate Source="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/GPNVSCMD.do?cmd=LFILE;filename=Diagnostics_FirstPage.mcml#ChooseCity"/>
        </Actions>
      </Changed>

      <Changed Source="[DataHost.Status]" InitialEvaluate="true">
        <Conditions>
          <Equality Source="[DataHost.Status]" Value="Success" />
        </Conditions>
        <Actions>
          <Set Target="[DataSet]" Value="[DataHost.ChannelChoice]" />
        </Actions>
      </Changed>
      <Changed Source="[Timer.Tick]">
        <Actions>
          <Invoke Target="[DataHost.ForceRefresh]" />
          <Set Target="[IsCurrentCity.Value]" Value="false"/>
          <Set Target="[DataSet.ChosenIndex]" Value="0"/>
          <DebugTrace Message="'Value'={0}">
            <Params>
              <ObjectPath ObjectPath="[DataSet.Options.Count]"/>
            </Params>
          </DebugTrace>

          <Set Target="[TargetSource]" Value="[CityId]">
            <Transformer>
              <FormatTransformer Format="PBDA://2734DC82-774D-4daa-A5AD-2838B5A58127/GPNVSCMD.do?cmd=SCAN;filename=Diagnostics_DataSource.mcml;city={0}"
                                 ExtendedFormat="####"/>
            </Transformer>
          </Set>

        </Actions>
      </Changed>

      <Binding Target="[DataHost.Source]" Source="[TargetSource]"/>

      <Condition Source="[IsCurrentCity.Value]" SourceValue="false">
        <Conditions>

	<IsValid Source="[DataSet.Chosen]"/>
          <Equality Source="[DataSet.Chosen!PropertySet.#Id!cor:String]" Value="[CityId]"/>
        </Conditions>
        <Actions>
          <Set Target="[IsCurrentCity.Value]" Value="true"/>
          <Set Target="[Scroller2.ChannelList]" Value="[DataSet.Chosen!PropertySet.#Signal!Choice]"/>
        </Actions>
      </Condition>

      <Condition Source="[IsCurrentCity.Value]" SourceValue="false">
        <Conditions>
          <Equality Source="[DataSet.HasNextValue]" Value="true"/>
          <Equality Source="[DataSet.Chosen!PropertySet.#Id!cor:String]" Value="[CityId]" ConditionOp="NotEquals"/>
        </Conditions>
        <Actions>
            <Invoke Target="[DataSet.NextValue]"/>
        </Actions>
      </Condition>

    </Rules>
    
    <Content><!--file://C:\Users\v-cpan\Desktop\PAGE\MCML\Diagnostics_DataSource.mcml-->
      <Panel>
        <Children>
          <me:ArrayListDataSetResultHost Name="DataHost" ThrowOnLoadError="false" />
          <Panel Layout="Anchor" Margins="0,46,100,20">
            <Children>
              <Text Name="TitleText" Content="[Title]" Color="color://me:TitleColor" Font="font://me:TitleFont">
                <LayoutInput>
                  <AnchorLayoutInput Left="Parent,.150" Top="Parent,0,0"/>
                </LayoutInput>
              </Text>
              <Graphic Content="image://me:WinLogo" MaximumSize="251,36" MinimumSize="251,36">
                <LayoutInput>
                  <AnchorLayoutInput Right="Parent,1,-30" Top="Parent,0,20"/>
                </LayoutInput>
              </Graphic>
              <Text Name="CityIdTxt" Content="[CitynameCN]" Color="color://me:SubTitleColor" Font="font://me:SubTitleFont">
                <LayoutInput>
                  <AnchorLayoutInput Left="Parent,.155" Top="TitleText,1,45"/>
                </LayoutInput>
              </Text>
             <Text Name="SubTitleText" Content="[SubTitle]" Color="color://me:SubTitleColor" Font="font://me:SubTitleFont">
                <LayoutInput>
                  <AnchorLayoutInput Left="CityIdTxt,1" Top="TitleText,1,45"/>
                </LayoutInput>
              </Text>
              <me:TextScroller Name="DescriptionText" ArrayList="[ArrayList]">
                <LayoutInput>
                  <AnchorLayoutInput Left="CityIdTxt,0" Top="SubTitleText,1,45"/>
                </LayoutInput>
              </me:TextScroller>

              <Panel Name="Contents" Layout="Anchor">
                <LayoutInput>
                  <AnchorLayoutInput Left="Parent,.155" Top="DescriptionText,1,16"/>
                </LayoutInput>
                <Children>
                  <me:SignalScroller Name="Scroller2">
                    <LayoutInput>
                      <AnchorLayoutInput Left="Parent,0" Top="Parent,0,18" />
                    </LayoutInput>
                  </me:SignalScroller>
                </Children>
              </Panel>
              <Panel FocusOrder="0">
                <LayoutInput>
                  <AnchorLayoutInput Right="Parent,0.932" Bottom="Parent,1,-5"/>
                </LayoutInput>
                <Layout>
                  <FlowLayout StripAlignment="Far" Orientation="Horizontal" Spacing="20,0"/>
                </Layout>
                <Children>
                  <me:Button Name="BackButton" Command="[Back]" FocusOrder="1"/>
                  <me:Button Name="NextButton" Command="[Next]" FocusOrder="0"/>
                  <me:Button Name="SkipButton" Command="[Skip]" FocusOrder="2"/>
                </Children>
              </Panel>
            </Children>
          </Panel>
          <me:Background Name="Background"/>
        </Children>
      </Panel>
    </Content>
  </UI>
  
  <UI Name="DataTransfer">
    <Properties>
      <cor:String Name="TargetSource" String="$Required"/>
      <!--<ICommand Name="RefreshCommand" ICommand="$Required"/>-->
      <Choice Name="ResultSet" Choice="$Required"/>
      <!--<EditableText Name="RequestStatus" EditableText="$Required"/>-->
      
    </Properties>
    <Locals>
      <Timer Name="Timer" Interval="1000" Enabled="true"/>
    </Locals>
    <Rules>
      <!-- Force a Refresh of the Data -->
      <!--<Changed Source="[RefreshCommand.Invoked]">
        <Actions>
          <Invoke Target="[DataHost.ForceRefresh]" />
        </Actions>
      </Changed>-->
      <Changed Source="[Timer.Tick]">
        <Actions>
          <Invoke Target="[DataHost.ForceRefresh]" />

          <DebugTrace Message="'Value'={0}">
            <Params>
              <ObjectPath ObjectPath="[ResultSet.Options.Count]"/>
            </Params>
          </DebugTrace>
        </Actions>
      </Changed>
      <!-- Bind the Source for the DataHost -->
      <Binding Target="[DataHost.Source]" Source="[TargetSource]" />

      <!-- Bind DataHost.Status to RequestStatus.Value to Filter up status info -->
      <!--<Binding Target="[RequestStatus.Value]" Source="[DataHost.Status]" >
        <Transformer>
          <FormatTransformer/>
        </Transformer>
      </Binding>-->

      <!-- If the status has changed and the value is not "Success," then we have -->
      <!-- completed a load. If so, grab the ResultSet and pass it up.            -->
      <Changed Source="[DataHost.Status]" InitialEvaluate="true">
        <Conditions>
          <Equality Source="[DataHost.Status]" Value="Success" />
        </Conditions>
        <Actions>
          <Set Target="[ResultSet]" Value="[DataHost.ChannelChoice]" />
        </Actions>
      </Changed>
    </Rules>

    <Content>
      <me:ArrayListDataSetResultHost Name="DataHost" ThrowOnLoadError="false" />
    </Content>
  </UI>

  <!-- Any Data should conform to this format.  It should be valid MCML that -->
  <!-- contains a UI with a ResultSet Property.                              -->
  <UI Name="ArrayListDataSetResultHost">

    <Properties>
      <Choice Name="ChannelChoice"/>
    </Properties>

  </UI>
  <UI Name="SignalScroller">
    <Properties>
      <Choice Name="ChannelList"/>
    </Properties>
    <Locals>
      <!-- The ScrollingHandler which reacts to user keyboard input. -->
      <!-- NOTE: HandlerStage must be "Bubbled."                     -->
      <ScrollingHandler Name="ScrollingHandler" HandlerStage="Bubbled"/>

      <!-- ScrollingData contains many ways to customize how scrolling -->
      <!-- should behave. It has methods to change the current scroll  -->
      <!-- position and it also reports the position. In this case,    -->
      <!-- the default values are used for the sample.                 -->
      <ScrollingData Name="ScrollingData" />
    </Locals>
    <Rules>
      <!-- Give ScrollingData to ScrollingHandler. -->
      <Default Target="[ScrollingHandler.ScrollingData]" Value="[ScrollingData]"/>
      <!-- Give Repeater to ScrollingData. -->
      <Default Target="[ScrollingData.Repeater]" Value="[ListRepeater]"/>
      <Binding Source="[ChannelList.Options]" Target="[ListRepeater.Source]"/>
    </Rules>
    <Content>
          <Graphic Padding="30,0,30,0" Content="image://me:ListFrame" Layout="VerticalFlow" MaximumSize="550,170" MinimumSize="550,170">
            <Children>
              <Panel Name="Field" Padding="10,0,0,0">
                <Layout>
                  <FlowLayout Orientation="Horizontal" ItemAlignment="Center" StripAlignment="Near" Spacing="30,0"/>
                </Layout>
                <Children>    
                  <Text Name="Frequency" Content="频率" Color="color://me:SubTitleColor" Font="font://me:DescriptionFont" MaximumSize="100,0" MinimumSize="100,0"/>
                  <Text Name="Name" Content="类型" Color="color://me:SubTitleColor" Font="font://me:DescriptionFont" MaximumSize="50,0" MinimumSize="50,0"/>
                  <Text Name="SignalStrength" Content="信号强度" Color="color://me:SubTitleColor" Font="font://me:DescriptionFont" MaximumSize="100,0" MinimumSize="100,0"/>
                  <Text Name="SignalQuality" Content="信号质量" Color="color://me:SubTitleColor" Font="font://me:DescriptionFont" MaximumSize="100,0" MinimumSize="100,0"/>
                </Children>
              </Panel>
              <!-- The Scroller. It referrs to the ScrollingData too. -->
              <Scroller Orientation="Vertical" FadeSize="-1" ScrollingData="[ScrollingData]">
                <Children>
                  <!-- The Repeater. A direct child of the Scroller. -->
                  <Repeater Name="ListRepeater" Source="[ChannelList.Options]">
                    <Layout>
                      <FlowLayout Orientation="Vertical" Spacing="0,0"
                                  ItemAlignment="Center"/>
                    </Layout>
                    <Content>
                      <!-- Repeating out the items. -->
                      <me:ListItem Choice="[ChannelList]" Item="[RepeatedItem!PropertySet]" Index="[RepeatedItemIndex]"/>
                    </Content>
                  </Repeater>
                  
                </Children>
              </Scroller>
            </Children>
          </Graphic>
    </Content>
  </UI>
  <!-- A UI that is key-interactive for demonstrating the Scroller. -->
  <UI Name="ListItem">
    <Properties>
      <Choice Name="Choice" Choice="$Required"/>
      <PropertySet Name="Item" PropertySet="$Required"/>
      <Index Name="Index" Index="$Required" />

      <!-- Background color properties. -->
      <Color Name="BackgroundColor" Color="DimGray"/>
      <Color Name="BackgroundFocusedColor" Color="DarkGray"/>
      <Color Name="BackgroundHoverColor" Color="PaleGoldenrod"/>
      <Color Name="BackgroundPressedColor" Color="White"/>

      <!-- Label color properties. -->
      <Color Name="LabelColor" Color="White"/>
      <Color Name="LabelFocusedColor" Color="White"/>
      <Color Name="LabelHoverColor" Color="DimGray"/>
      <Color Name="LabelPressedColor" Color="Black"/>

      <!-- Label font property. -->
      <Font Name="LabelFont" Font="Microsoft YaHei,16"/>
    </Properties>
    <Locals>
      <ClickHandler Name="Clicker"/>
    </Locals>
    <Rules>
      <Binding Target="[Accessible.IsPressed]" Source="[Clicker.Clicking]" />
      <Binding Target="[Accessible.IsFocusable]" Source="[Input.KeyInteractive]" />
      <Binding Target="[Accessible.IsFocused]" Source="[Input.KeyFocus]" />
      <Default Target="[Accessible.Role]" Value="PushButton" />
      <Default Target="[Input.MakeTopmostOnFocus]" Value="true" />
      <Default Target="[Input.KeyInteractive]" Value="false" />

      <Changed Source="[Choice.ChosenIndex]">
        <Conditions>
          <Equality Source="[Choice.ChosenIndex]" Value="[Index.SourceValue]"/>
        </Conditions>
        <Actions>
          <Set Target="[Name.Color]" Value="[BackgroundHoverColor]"/>
        </Actions>
      </Changed>
      <Condition Source="[Input.KeyFocus]" SourceValue="false">
        <Actions>
          <Set Target="[Background.Content]" Value="null"/>
        </Actions>
      </Condition>

      <Condition Source="[Input.KeyFocus]" SourceValue="true">
        <Actions>
          <Set Target="[Name.Color]" Value="[LabelFocusedColor]"/>
          <Set Target="[Background.Content]" Value="image://me:FocusedBackground"/>
        </Actions>
      </Condition>
      <Condition Source="[Clicker.Clicking]" SourceValue="true">
        <Actions>
          <Set Target="[Name.Color]" Value="[LabelPressedColor]"/>
          <Set Target="[Choice.ChosenIndex]" Value="[Index.SourceValue]" />
        </Actions>
      </Condition>
    </Rules>
    <Content>
      <Graphic Name="Background" MaximumSize="470,35" MinimumSize="470,35" Padding="10,3,10,3">
        <Layout>
          <FlowLayout Orientation="Horizontal" ItemAlignment="Center" StripAlignment="Near" Spacing="30,0"/>
        </Layout>
        <Children>
          <Text Name="Frequency" Content="[Item.#Frequency!cor:String]" Font="[LabelFont]" Color="[LabelColor]" MaximumSize="100,0" MinimumSize="100,0"/>
          <Text Name="Name" Content="[Item.#Size!cor:String]" Font="[LabelFont]" Color="[LabelColor]"  MaximumSize="50,0" MinimumSize="50,0"/>
          <me:ProgressBar Name="SignalStrength" Progress="[Item.#SignalStrength!cor:Single]"  MaximumSize="100,0" MinimumSize="100,0"/>
          <me:ProgressBar Name="SignalQuality" Progress="[Item.#SignalQuality!cor:Single]"  MaximumSize="100,0" MinimumSize="100,0"/>
        </Children>
      </Graphic>
    </Content>
  </UI>
  <UI Name="TextScroller">
    <Properties>
      <ArrayListDataSet Name="ArrayList" ArrayListDataSet="$Required"/>
    </Properties>
    <Locals>
      <!-- The ScrollingHandler which reacts to user keyboard input. -->
      <!-- NOTE: HandlerStage must be "Bubbled."                     -->
      <ScrollingHandler Name="ScrollingHandler" HandlerStage="Bubbled"/>

      <!-- ScrollingData contains many ways to customize how scrolling -->
      <!-- should behave. It has methods to change the current scroll  -->
      <!-- position and it also reports the position. In this case,    -->
      <!-- the default values are used for the sample.                 -->
      <ScrollingData Name="ScrollingData" />
    </Locals>
    <Rules>
      <!-- Give ScrollingData to ScrollingHandler. -->
      <Default Target="[ScrollingHandler.ScrollingData]" Value="[ScrollingData]"/>
      <!-- Give Repeater to ScrollingData. -->
      <Default Target="[ScrollingData.Repeater]" Value="[ListRepeater]"/>
    </Rules>
    <Content>
      <Panel Layout="VerticalFlow">
        <Children>
          <Panel Padding="0,0,0,0">
            <Children>
              <!-- The Scroller. It referrs to the ScrollingData too. -->
              <Scroller Orientation="Vertical" FadeSize="-5" ScrollingData="[ScrollingData]">
                <Children>
                  <!-- The Repeater. A direct child of the Scroller. -->
                  <Repeater Name="ListRepeater" Source="[ArrayList]">
                    <Layout>
                      <FlowLayout Orientation="Vertical" Spacing="0,0"
                                  ItemAlignment="Near"/>
                    </Layout>
                    <Content>
                      <!-- Repeating out the items. -->
                      <Text Content="[RepeatedItem!cor:String]" WordWrap="true" Color="color://me:DescriptionColor"  Font="font://me:DescriptionFont"/>
                    </Content>
                  </Repeater>
                </Children>
              </Scroller>
            </Children>
          </Panel>
        </Children>
      </Panel>
    </Content>
  </UI>

  <UI Name="ProgressBar">
    <Properties>
      <cor:Single Name="Progress"/>
      <Color Name="BarColor" Color="168,255,000"/>
    </Properties>

    <Locals>
      <!-- Model.Value will be bound to the Right percent of this input -->
      <FormLayoutInput Name="ProgressInput"
                       Left="Parent,0"
                       Right="Parent,0.5"
                       Top="Parent,0"
                       Bottom="Parent,1"/>
      <FormLayoutInput Name="DummyInput"
                       Left="Parent,0"
                       Right="Parent,0.5"
                       Top="Parent,0"
                       Bottom="Parent,1"/>
      
    </Locals>

    <Rules>
      <!-- Focused styling -->
      <!--<Condition Source="[Focused]"
                 SourceValue="true">
        <Actions>
          <Set Target="[Label.Visible]"
               Value="true"/>
          <Set Target="[BarBackground.Content]"
               Value="[FocusImage]"/>
          <Set Target="[Bar.Content]"
               Value="color://styles:Text.Negative"/>
          <Set Target="[Bar.Alpha]"
               Value="1.0"/>
        </Actions>
      </Condition>-->

      <!-- Apply the label -->
      <Rule>
        <Conditions>
          <IsValid Source="[Progress]"/>
        </Conditions>
        <Actions>
          <Set Target="[ProgressInput.Right.Percent]"
               Value="[Progress]" />

          <!-- An unfortunate extra step ... because layout inputs do not fire        -->
          <!-- property change notifications, the system doesn't know that the layout -->
          <!-- has changed; to get around this, we need to set the layout input       -->
          <!-- property itself; but even that isn't sufficient because Media Center   -->
          <!-- sees that the old and new value are the same object, and treats it     -->
          <!-- as no change, so we have to go one further and set the layout input    -->
          <!-- to a dummy value and then back to the right value, so that the         -->
          <!-- system notices the change                                              -->
          <Set Target="[Bar.LayoutInput]"
               Value="[DummyInput]"
               ExclusiveApply="false"/>
          <Set Target="[Bar.LayoutInput]"
               Value="[ProgressInput]"/>
        </Actions>
      </Rule>
    </Rules>

    <Content>

          <!-- Background graphic -->
          
          <Graphic Name="BarBackground"  Content="image://me:ListFrame"
                   Layout="Form"
                   MaximumSize="100,20">
            <Children>

              <!-- Current progress value -->
              <ColorFill Name="Bar"
                         Content="[BarColor]"
                         Alpha="0.5"/>

            </Children>
          </Graphic>

    </Content>
  </UI>
  <UI Name="Background">
    <Content>
      <Panel Layout="Anchor">
        <Children>
          <Graphic Content="image://me:Background1" Alpha="1" MaximumSize="0,110" MinimumSize="0,110" >
            <LayoutInput>
              <AnchorLayoutInput Top="Parent,0"/>
            </LayoutInput>
          </Graphic>
          <Graphic Content="image://me:Background2" Alpha="1" MaximumSize="0,110" MinimumSize="0,110" >
            <LayoutInput>
              <AnchorLayoutInput Bottom="Parent,1"/>
            </LayoutInput>
          </Graphic>
          <Graphic Content="image://me:Background" Layout="Fill" Alpha="1"/>

        </Children>
      </Panel>
    </Content>
  </UI>
  <UI Name="Button">
    <Properties>
      <!-- Command is a required parameter. -->
      <ICommand Name="Command" ICommand="$Required"/>

      <!-- Background color properties. -->
      <Color Name="BackgroundColor" Color="DimGray"/>
      <Color Name="BackgroundFocusedColor" Color="DarkGray"/>
      <Color Name="BackgroundHoverColor" Color="PaleGoldenrod"/>
      <Color Name="BackgroundPressedColor" Color="White"/>

      <!-- Label color properties. -->
      <Color Name="LabelColor" Color="White"/>
      <Color Name="LabelFocusedColor" Color="White"/>
      <Color Name="LabelHoverColor" Color="DimGray"/>
      <Color Name="LabelPressedColor" Color="Black"/>

      <!-- Label font property. -->
      <Font Name="LabelFont" Font="Microsoft YaHei,16"/>
    </Properties>

    <Locals>

      <!-- React to "click" input. -->
      <ClickHandler Name="Clicker"/>

    </Locals>

    <Rules>
      <Binding Target="[Accessible.Name]" Source="[Command.Description]" />
      <Binding Target="[Accessible.IsFocusable]" Source="[Input.KeyInteractive]" />
      <Binding Target="[Accessible.IsFocused]" Source="[Input.KeyFocus]" />
      <Default Target="[Accessible.DefaultAction]" Value="Press" />
      <Default Target="[Accessible.DefaultActionCommand]" Value="[Command]" />
      <Default Target="[Accessible.Role]" Value="PushButton" />
      <Default Target="[Input.MakeTopmostOnFocus]" Value="true" />
      <Default Target="[Input.KeyInteractive]" Value="true" />

      <!-- The command description is displayed by the text box. A  -->
      <!-- binding is used in case the description changes at       -->
      <!-- runtime.                                                 -->
      <Binding Source="[Command.Description]" Target="[Label.Content]"/>

      <Binding Source="[Command]" Target="[Clicker.Command]"/>

      <!-- Change color on click. -->
      <Condition Source="[Clicker.Clicking]" SourceValue="true">
        <Actions>
          <Set Target="[Background.Content]" Value="image://me:PressedBackground"/>
          <Set Target="[Label.Color]" Value="[LabelPressedColor]"/>
        </Actions>
      </Condition>

      <!-- Change color on mouse focus. -->
      <Condition Source="[Input.MouseFocus]" SourceValue="true">
        <Actions>
          <Set Target="[Background.Content]" Value="image://me:HoverBackground"/>
          <Set Target="[Label.Color]" Value="[LabelHoverColor]"/>
        </Actions>
      </Condition>
      <!-- Change color on key focus. -->
      <Condition Source="[Input.KeyFocus]" SourceValue="true">
        <Actions>
          <Set Target="[Background.Content]" Value="image://me:FocusedBackground"/>
          <Set Target="[Label.Color]" Value="[LabelFocusedColor]"/>
        </Actions>
      </Condition>
    </Rules>
    <Content>

      <!-- Solid background color. -->
      <Graphic Name="Background" Content="image://me:NofocusedBackground" Layout="Center" MaximumSize="166,30" MinimumSize="166,30">
        <Children>
          <!-- The label to display. -->
          <Text Name="Label" Color="[LabelColor]" Font="[LabelFont]"/>
        </Children>
      </Graphic>
    </Content>
  </UI>
</Mcml>